package com.haoshuang.zhouzhoubang.ui.page.mine.notice.member

import androidx.lifecycle.rxLifeScope
import com.haoshuang.zhouzhoubang.base.request
import com.haoshuang.zhouzhoubang.model.bean.GroupBean
import com.mufeng.libs.base.BaseViewModel
import com.mufeng.libs.state.StateData
import com.mufeng.libs.state.StatefulMutableLiveData

class PublishNoticeChooseMemberViewModel : BaseViewModel() {

    val getTeamMemberListData = StatefulMutableLiveData<ArrayList<GroupBean.AllPeople>>()
    fun getTeamMemberList(vararg params: Pair<String, Any?>) {
        rxLifeScope.launch {
            request<ArrayList<GroupBean.AllPeople>>("api/Team/team_member_list", *params,
                onStart = {
                    getTeamMemberListData.value = StateData.Loading
                },
                onError = { code, msg ->
                    getTeamMemberListData.value = StateData.Error(code, msg)
                }, onSuccess = {
                    getTeamMemberListData.value = StateData.Success(it)
                })
        }
    }

}